<template>
  <div class="item" @click="gooditemclick">
    <img :src="item.show?.img || item.image" alt="" v-lazy="item.show?.img || item.image" />
    <div class="title">{{ item.title }}</div>
    <div class="footer">
      <div class="price">￥{{ item.price }}</div>
      <div class="cafv">{{ item.cfav }}</div>
    </div>
  </div>
</template>

<script>
import { useRouter } from 'vue-router'
export default {
  props: ['item'],
  setup(props) {
    const router = useRouter()
    const gooditemclick = () => {
      router.push('/detail/' + (props.item.iid || props.item.shop_id))
    }
    return {
      gooditemclick
    }
  }
}
</script>

<style lang="less" scoped>
.item {
  width: 48%;
  img {
    width: 100%;
    border-radius: 5px;
  }
  .title {
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .footer {
    padding: 8px;
    display: flex;
    justify-content: space-around;
    color: deeppink;
    align-items: center;
    .price {
      font-size: 18px;
    }
    .cafv::before {
      content: '';
      display: inline-block;
      width: 20px;
      height: 20px;
      background: url('../../../assets/img/home/get.png') no-repeat center center;
      background-size: 20px 20px;
      vertical-align: middle;
      margin-right: 6px;
    }
  }
}
</style>
